package com.avantis.common.entity;

import com.avantis.common.entity.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @Author: tracywang
 * @Date: 2018/12/25
 * @Descrption:
 */
@Entity
@Table(name = "k_warehouse")
@Data
@ApiModel(value = "WareHouse", description = "仓库关联信息")
public class WareHouse extends BaseEntity implements Serializable {

    /**
     * 仓库编码
     */
    @ApiModelProperty("仓库编码")
    @Column
    private String warehouseCode;

    /**
     * 仓库名称
     */
    @ApiModelProperty("仓库名称")
    @Column
    private String warehouseName;

    /**
     * 描述
     */
    @ApiModelProperty("描述")
    @Column
    private String description;

    /**
     * 联系人
     */
    @ApiModelProperty("联系人")
    @Column
    private String contacts;

    /**
     * 联系电话
     */
    @ApiModelProperty("联系电话")
    @Column
    private String contactPhone;

    /**
     * 仓库状态 0启用 1禁用
     */
    @ApiModelProperty("仓库状态")
    @Column
    private Integer enable = 0;

    //是否主仓 0不是 1是 默认1
    @ApiModelProperty("是否主仓")
    @Column
    private Integer isMain = 1;

    @ApiModelProperty("地址")
    @Column
    private String address;

    @ApiModelProperty("邮箱")
    @Column
    private String email;

    @JsonIgnore
    @ManyToMany(mappedBy = "warehouses")
    private Set<AdminUser> warehouses = new HashSet<>();

}
